package com.chinasoft.serviceImpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.chinasoft.entity.Admin;
import com.chinasoft.mapper.Adminmapper;
import com.chinasoft.service.AdminService;


@Service
public class AdminServiceImpl implements AdminService{
	@Autowired
	private Adminmapper Adminmapper;
	/*@Override
	public Admin checkLogin(String name, String password) {
		Admin admin = Adminmapper.findByUsername(name);
		if (admin != null && admin.getPassword().equals(password)) {

			return admin;
		}
		return null;
	
	}*/
	@Override
	public Admin findAdmin(Admin admin) {
		List<Admin> list = Adminmapper.findAdmin();
		System.out.println(list.size());
		for (Admin admin2 : list) {
			if ((admin2.getName().equals(admin.getName()))&&(admin2.getPassword().equals(admin.getPassword()))) {
				return admin2;
			}
		}
		return null;
	}

}
